<template>
  <div class="pagestyle">
    <list_controller ref="zujianname" :options="state.options" :noprintDownShow="true">
      <template v-slot:opraCurdBtnlist="row">
        <span>
          <el-button
            class="tableFontSize"
            type="primary"
            link
            size="small"
            @click="openPointEdit(row.row.row,1)"
            >查看</el-button
          >
        </span>
      </template>
      <template v-slot:selectNamelist> 测点历史 </template>
    </list_controller>
    <!-- 测点新增 -->
    <el-drawer
      v-model="open_add2"
      custom-class="edit"
      @close="closeMoadl"
      :close-on-click-modal="false"
      :modal="true"
    >
      <template #header>
        <div class="d_header">
          <div class="title">
            <svg-icon icon-class="biaotitubiao" />
            <div style="margin: 0 0 0 8px">
              测点详情(所属分站{{ form_add2.stationCode }})
            </div>
          </div>
        </div>
      </template>
      <template #default>
        <div class="edit_box">
          <el-form
            :model="form_add2"
            label-width="auto"
            label-position="top"
            ref="formRef1"
          >
            <div class="basic_info2">
              <el-row :gutter="16">
                <el-col :span="6">
                  <el-form-item label="测点编号">
                    <div class="data_item">
                      <el-select
                        style="width: 200px"
                        clearable
                        filterable
                        v-model="form_add2.stationCode"
                        placeholder="请选择"
                        disabled
                      >
                        <el-option
                          v-for="item in pointNoList"
                          :key="item"
                          :label="item"
                          :value="item"
                        >
                        </el-option>
                      </el-select>
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="测点类型">
                    <div class="data_item">
                      <el-select
                        clearable
                        filterable
                        style="width: 200px"
                        v-model="form_add2.pointTypeName"
                        placeholder="请选择"
                        @change="pointTypeChange"
                        disabled
                      >
                        <el-option
                          v-for="item in pointTypeList"
                          :key="item.value"
                          :label="item.name"
                          :value="item.value"
                        >
                        </el-option>
                      </el-select>
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form_add2.pointType == 1">
                  <el-form-item label="传感器名称">
                    <div class="data_item">
                      <el-input
                      style="width: 416px"
                      disabled
                      v-model="form_add2.sensorName"
                      placeholder="请输入"
                    />
                      
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form_add2.pointType == 2">
                  <el-form-item label="传感器名称">
                    <div class="data_item">
                      <el-select
                        style="width: 200px"
                        clearable
                        filterable
                        v-model="form_add2.sensorId"
                        placeholder="请选择"
                        @change="mulsensorIdChange"
                        disabled
                      >
                        <el-option
                          v-for="item in mulsensorIdList"
                          :key="item.id"
                          :label="item.sensorName"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                    </div>
                    <el-popover
                      placement="right"
                      :width="600"
                      trigger="hover"
                      v-if="looksensorObj"
                    >
                      <template #reference>
                        <el-button
                          type="primary"
                          link
                          style="margin-right: 16px"
                        >
                          查看传感器参数
                        </el-button>
                      </template>
                      <template #default>
                        <el-row :gutter="20" class="fac">
                          <el-col :span="4">
                            <img
                              v-if="looksensorObj.imagePath"
                              style="height: 100px; width: 100%"
                              :src="looksensorObj.imagePath"
                            />
                            <img v-else src="@/assets/images/noimg.png" />
                          </el-col>
                          <el-col :span="20">
                            <el-row :gutter="20">
                              <el-col
                                style="font-size: 16px; font-weight: 700"
                                :span="24"
                              >
                                {{ looksensorObj.sensorName }}
                              </el-col>
                              <el-col
                                :span="12"
                                v-for="item in looksensorObj.sensorList"
                              >
                                <span
                                  style="
                                    padding: 4px 10px;
                                    display: inline-block;
                                    background-color: rgba(242, 244, 245, 1);
                                    border-radius: 4px;
                                    margin-top: 10px;
                                  "
                                  >{{ item.name }}</span
                                >
                              </el-col>
                            </el-row>
                          </el-col>
                        </el-row>
                      </template>
                    </el-popover>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form_add2.pointType == 3">
                  <el-form-item>
                    <label slot="label">
                      <span style="color: #f56c6c">*</span><span>模版名称</span>
                      <el-button
                        link
                        type="primary"
                        style="margin-left: 5px"
                        disabled
                        @click="addtemplateClick"
                        >新增模版</el-button
                      >
                    </label>
                    <el-cascader
                      class="w100"
                      ref="templateref"
                      v-model="form_add2.templateId"
                      :options="templateTreeList"
                      clearable
                      disabled
                      :props="{
                        value: 'id',
                        label: 'templateName',
                        emitPath: false,
                      }"
                      @change="templateTreeChange"
                    />
                  </el-form-item>
                </el-col>
                <el-col
                  :span="24"
                  v-if="expressionVoList.length > 0 && form_add2.pointType == 3"
                >
                  <el-form-item>
                    <label slot="label">
                      <span style="color: #f56c6c">*</span
                      ><span>虚拟表达式</span>
                    </label>
                    <div class="w100">
                      <span v-for="item in expressionVoList" :key="item">
                        <el-select
                          v-if="item.obj"
                          clearable
                          filterable
                          v-model="item.value"
                          :placeholder="item.value1"
                          disabled
                        >
                          <el-option
                            v-for="item1 in item.obj.codeList"
                            :key="item1"
                            :label="item1"
                            :value="item1"
                          >
                          </el-option>
                        </el-select>
                        <span v-else>{{ item.value }}</span>
                      </span>
                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="12">
                  <el-form-item label="安装地点">
                    <div class="data_item">
                      <el-select
                        style="width: 416px"
                        clearable
                        filterable
                        allow-create
                        v-model="form_add2.pointPlaceName"
                        disabled
                        placeholder="请选择"
                      >
                        <el-option
                          v-for="item in addressInfoList"
                          :key="item.id"
                          :label="item.placeName"
                          :value="item.placeName"
                        >
                        </el-option>
                      </el-select>
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="所在区域">
                    <div class="data_item">
                       <el-input
                      style="width: 416px"
                      disabled
                      v-model="form_add2.pointAreaName"
                      placeholder="请输入"
                    />

                    </div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="16">
                <el-col :span="12" v-if="needPlaceType == true">
                  <el-form-item label="地点类型">
                     <el-input
                      style="width: 100%"
                      disabled
                      v-model="form_add2.placeTypeName"
                      placeholder="请输入"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="6" v-if="form_add2.pointType != 3">
                  <el-form-item label="瓦斯抽放测点">
                    <el-switch disabled v-model="form_add2.isGasDrainage">
                    </el-switch>
                  </el-form-item>
                </el-col>
                <el-col :span="6" v-if="form_add2.isGasDrainage">
                  <el-form-item label="瓦斯抽放监测点组别">
                    <el-select
                      disabled
                      class="w100"
                      clearable
                      filterable
                      v-model="form_add2.gasDrainageGroupno"
                      placeholder="请选择"
                    >
                      <el-option
                        v-for="item in 4"
                        :key="item"
                        :label="item"
                        :value="item"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col
                  :span="6"
                  v-if="
                    form_add2.calibration &&
                    form_add2.pointType != 3 &&
                    !editpointId
                  "
                >
                  <el-form-item label="同步添加到标校管理">
                    <el-switch
                      disabled
                      v-model="form_add2.calibration.isCalibration"
                    >
                    </el-switch>
                  </el-form-item>
                </el-col>
                <el-col
                  :span="6"
                  v-if="
                    form_add2.pointType != 3 &&
                    form_add2.calibration?.isCalibration
                  "
                >
                  <el-form-item label="标校间隔时刻(天)">
                    <el-input
                      disabled
                      oninput="value=value.replace(/[^\d.]/g,'')"
                      v-model.number="form_add2.calibration.intervalTime"
                      placeholder="请输入"
                      :min="1"
                      :max="365"
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form_add2.pointType != 3">
                  <el-form-item label="地理位置">
                    <div class="fbc">
                      <el-input
                        disabled
                        v-model="form_add2.locationX"
                        oninput="value =value.replace(/[^\-\d.]/g, '').replace(/^\./g,  '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1').replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1').replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1').replace(/(\.\d{8})\d*/, '$1')"
                      >
                        <template #prefix>
                          <span>X</span>
                        </template>
                      </el-input>
                      <el-input
                        disabled
                        v-model="form_add2.locationY"
                        oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                      >
                        <template #prefix>
                          <span>Y</span>
                        </template>
                      </el-input>
                      <el-input
                        disabled
                        v-model="form_add2.locationZ"
                        oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                      >
                        <template #prefix>
                          <span>Z</span>
                        </template>
                      </el-input>
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form_add2.pointType != 3">
                  <el-form-item label="设备唯一编号">
                    <el-input
                      disabled
                      v-model="form_add2.pointIdentifyingNo"
                      placeholder="请输入"
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
            <!-- 普通测点 -->
            <div v-if="form_add2.pointType == 1 || form_add2.pointType == 3">
              <el-row :gutter="20">
                <el-col :span="24" v-if="baohanD != 'S'">
                  <p class="activeNameTab">
                    <span
                      v-for="item in pointactiveNameList"
                      :key="item.type"
                      @click="ponitactiveNameTabClick(item.type)"
                    >
                      <span v-if="baohanD == 'D'">
                        <span v-if="form_add2.needGrandalarm">
                          <span
                            class="span"
                            :class="
                              activeNamePoint == item.type ? 'active' : ''
                            "
                            >{{ item.name }}</span
                          >
                        </span>
                        <span v-else>
                          <span
                            class="span"
                            :class="
                              activeNamePoint == item.type ? 'active' : ''
                            "
                            v-if="item.type != 2 && item.type != 4"
                            >{{ item.name }}</span
                          >
                        </span>
                      </span>
                      <span v-else>
                        <span v-if="form_add2.needGrandalarm && item.type == 2">
                          <span
                            class="span"
                            :class="
                              activeNamePoint == item.type ? 'active' : ''
                            "
                            >{{ item.name }}</span
                          >
                        </span>
                        <span v-if="item.type != 2">
                          <span
                            class="span"
                            :class="
                              activeNamePoint == item.type ? 'active' : ''
                            "
                            >{{ item.name }}</span
                          >
                        </span>
                      </span>
                    </span>
                  </p>
                </el-col>
                <el-col :span="24" v-if="baohanD != 'S'">
                  <div class="desc_box" v-if="activeNamePoint == 1">
                    <el-row :gutter="20">
                      <el-col :span="6">
                        <el-form-item label="报警模式">
                          <el-select
                            class="w100"
                            clearable
                            disabled
                            filterable
                            v-model="form_add2.alarmBasic.alarmType"
                            @change="alarmBasicChange"
                            placeholder="请选择"
                          >
                            <el-option
                              v-for="item in alarmBasicList"
                              :key="item.code"
                              :label="item.name + '报警'"
                              :value="item.code"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="16">
                        <el-form-item
                          label="上限报警值"
                          v-if="
                            (form_add2.alarmBasic.alarmType == 1 ||
                              form_add2.alarmBasic.alarmType == 3) &&
                            baohanD != 'D'
                          "
                        >
                          <div class="fbc">
                            <el-row :gutter="20">
                              <el-col :span="12">
                                <div class="fac">
                                  <span class="wn">报警值≥ </span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '').replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1').replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1').replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1').replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="form_add2.alarmBasic.upAlarmValue"
                                    placeholder="报警值≥"
                                  >
                                  </el-input>
                                </div>
                              </el-col>
                              <el-col :span="12">
                                <div class="fac">
                                  <span class="wn">解报值＜ </span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="
                                      form_add2.alarmBasic.upRelieveValue
                                    "
                                    placeholder="解报值＜"
                                  >
                                  </el-input>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-form-item>
                        <el-form-item
                          label="下限报警值"
                          v-if="
                            (form_add2.alarmBasic.alarmType == 2 ||
                              form_add2.alarmBasic.alarmType == 3) &&
                            baohanD != 'D'
                          "
                        >
                          <div class="fbc">
                            <el-row :gutter="20">
                              <el-col :span="12">
                                <div class="fac">
                                  <span class="wn">报警值≤</span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="
                                      form_add2.alarmBasic.downAlarmValue
                                    "
                                    placeholder="报警值≤"
                                  >
                                  </el-input>
                                </div>
                              </el-col>
                              <el-col :span="12">
                                <div class="fac">
                                  <span class="wn">解报值＞</span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
    '.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
    .replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
    .replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="
                                      form_add2.alarmBasic.downRelieveValue
                                    "
                                    placeholder="解报值＞"
                                  >
                                  </el-input>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8" v-if="form_add2.pointType != 3">
                        <el-form-item label="" label-position="left">
                          <span>预报警</span>
                          <el-switch
                            disabled
                            style="margin: 0 5px"
                            v-model="form_add2.prealarmBasic.hasPreAlarm"
                          >
                          </el-switch>
                          
                        </el-form-item>
                      </el-col>
                      <el-col :span="16"></el-col>
                      <el-col
                        :span="6"
                        v-if="
                          baohanD != 'D' && form_add2.prealarmBasic.hasPreAlarm
                        "
                      >
                        <el-form-item label="上限预报值">
                          <el-input
                            disabled
                            oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                            v-model="form_add2.prealarmBasic.upPrealarmValue"
                            placeholder="请输入"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col
                        :span="6"
                        v-if="
                          baohanD != 'D' && form_add2.prealarmBasic.hasPreAlarm
                        "
                      >
                        <el-form-item label="下限预报值">
                          <el-input
                            disabled
                            oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                            v-model="form_add2.prealarmBasic.downPrealarmValue"
                            placeholder="请输入"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col
                        :span="12"
                        v-if="
                          baohanD == 'D' && form_add2.prealarmBasic.hasPreAlarm
                        "
                      >
                        <el-row :gutter="20">
                          <el-col :span="12" style="margin-top: 16px">
                            <el-radio-group
                              disabled
                              v-model="form_add2.prealarmBasic.prealarmType"
                              class="fbc"
                            >
                              <el-radio
                                v-show="item.code != 0"
                                :label="item.code"
                                v-for="item in alarmBasicList"
                                :key="item"
                              >
                                {{ item.name + "报警" }}</el-radio
                              >
                            </el-radio-group>
                          </el-col>
                        </el-row>
                      </el-col>
                      <el-col
                        :span="6"
                        v-if="form_add2.prealarmBasic.hasPreAlarm"
                      >
                        <el-form-item label="超时">
                          <span class="fac">
                            <el-select
                              disabled
                              clearable
                              filterable
                              v-model="form_add2.prealarmBasic.prealarmTimeout"
                              placeholder="请选择"
                            >
                              <el-option
                                v-for="item in prealarmTimeoutData"
                                :key="item"
                                :label="item"
                                :value="item"
                              >
                              </el-option>
                            </el-select>
                            <span class="wn">分钟</span>
                          </span>
                        </el-form-item>
                      </el-col>
                      <el-col
                        :span="24"
                        v-if="baohanD != 'D' && form_add2.pointType != 3"
                      >
                        <el-form-item label="">
                          <span>恒值预报警</span>
                          <el-switch
                            disabled
                            style="margin: 0 5px"
                            v-model="
                              form_add2.prealarmBasic.hasConstantPreAlarm
                            "
                          >
                          </el-switch>
                        </el-form-item>
                      </el-col>

                      <el-col
                        :span="8"
                        v-if="
                          baohanD != 'D' &&
                          form_add2.prealarmBasic.hasConstantPreAlarm
                        "
                      >
                        <el-form-item label="恒值持续时间">
                          <span class="fac">
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="form_add2.prealarmBasic.constantTime"
                              placeholder="请输入"
                            >
                            </el-input>
                            <span class="wn">分钟</span>
                          </span>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </div>
                  <!-- 分级配置 -->
                  <div class="desc_box" v-if="activeNamePoint == 2">
                    <el-row :gutter="20">
                      <el-col :span="6">
                        <el-form-item
                          :label="baohanD == 'D' ? '分级报警' : '上限分级报警'"
                        >
                          <el-switch
                            disabled
                            v-model="form_add2.hasUpGrandAlarm"
                            @change="hasUpGrandAlarmChange"
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="6" v-if="baohanD != 'D'">
                        <el-form-item label="下限分级报警">
                          <el-switch
                            disabled
                            v-model="form_add2.hasDownGrandAlarm"
                            @change="hasDownGrandAlarmChange"
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="6">
                        <el-form-item label="启用多级报警">
                          <el-switch
                            disabled
                            v-model="form_add2.hasMoreGrandAlarm"
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="6" v-if="baohanD != 'D'">
                        <el-form-item label="启用涨/跌幅">
                          <el-switch
                            disabled
                            v-model="form_add2.hasChangeGrandAlarm"
                          />
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row
                      v-if="
                        form_add2.hasUpGrandAlarm && form_add2.hasDownGrandAlarm
                      "
                    >
                      <el-radio-group disabled v-model="radio1">
                        <el-radio-button
                          label="上限分级报警"
                          value="上限分级报警"
                        />
                        <el-radio-button
                          label="下限分级报警"
                          value="下限分级报警"
                        />
                      </el-radio-group>
                    </el-row>
                    <el-row
                      :gutter="20"
                      style="margin: 0 10px"
                      v-if="
                        radio1 == '上限分级报警' && form_add2.hasUpGrandAlarm
                      "
                    >
                      <el-row :gutter="20" v-if="baohanD != 'D'">
                        <el-col :span="24" v-if="form_add2.hasChangeGrandAlarm">
                          <p
                            class="drawer_sub_title"
                            style="margin-left: 0; padding-top: 10px"
                          >
                            <span> 变化参数设置</span>
                          </p>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="变化率判断门限≥">
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                              v-model="
                                form_add2.upGrandalarmBasic.grandalarmRate
                                  .thresholdValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="变化率持续周期">
                            <el-input
                              disabled
                              oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                              v-model="
                                form_add2.upGrandalarmBasic.grandalarmRate
                                  .rateCycle
                              "
                              placeholder="请输入"
                            >
                              <template #append>秒</template>
                            </el-input>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <el-row :gutter="20">
                        <el-col :span="24" v-if="form_add2.hasMoreGrandAlarm">
                          <el-row :gutter="20">
                            <el-col :span="24">
                              <p class="pfz">六级报警</p>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="">
                                <div class="fac">
                                  <span class="wn">上限预报值≥</span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="
                                      form_add2.upGrandalarmBasic.grandsixValue
                                    "
                                    placeholder="请输入"
                                  >
                                    <template #append>{{
                                      baohanunit
                                    }}</template>
                                  </el-input>
                                </div>
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="">
                                <div class="fac">
                                  <span
                                    class="wn"
                                    v-html="
                                      baohanD == 'D'
                                        ? '持续时间≤'
                                        : '或 持续时间≤'
                                    "
                                  ></span>
                                  <el-input
                                    disabled
                                    oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                    v-model="
                                      form_add2.upGrandalarmBasic.grandsixTime
                                    "
                                    placeholder="请输入"
                                  >
                                    <template #append>分钟</template>
                                  </el-input>
                                </div>
                              </el-form-item>
                            </el-col>
                            <el-col :span="24">
                              <p class="pfz">五级报警</p>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="">
                                <div class="fac">
                                  <span class="wn">上限预报值≥</span>
                                  <el-input
                                    disabled
                                    oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                    v-model="
                                      form_add2.upGrandalarmBasic.grandfiveValue
                                    "
                                    placeholder="请输入"
                                  >
                                    <template #append>{{
                                      baohanunit
                                    }}</template>
                                  </el-input>
                                </div>
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="">
                                <div class="fac">
                                  <span
                                    class="wn"
                                    v-html="
                                      baohanD == 'D'
                                        ? '持续时间≤'
                                        : '或 持续时间≤'
                                    "
                                  ></span>
                                  <el-input
                                    disabled
                                    oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                    v-model="
                                      form_add2.upGrandalarmBasic.grandfiveTime
                                    "
                                    placeholder="请输入"
                                  >
                                    <template #append>分钟</template>
                                  </el-input>
                                </div>
                              </el-form-item>
                            </el-col>
                          </el-row>
                        </el-col>
                        <el-col :span="24">
                          <p class="pfz">四级报警</p>
                        </el-col>
                        <el-col :span="8" v-if="baohanD != 'D'">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">上限预报值≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandfourValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item label="">
                            <div class="fac">
                              <span
                                class="wn"
                                v-html="
                                  baohanD == 'D' ? '持续时间≤' : '或 持续时间≤'
                                "
                              ></span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandfourTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 涨幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandalarmRate
                                    .rateFourValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <p class="pfz">三级报警</p>
                        </el-col>
                        <el-col :span="8" v-if="baohanD != 'D'">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">上限预报值≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandthreeValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item label="">
                            <div class="fac">
                              <span
                                class="wn"
                                v-html="
                                  baohanD == 'D' ? '持续时间≤' : '或 持续时间≤'
                                "
                              ></span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandthreeTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 涨幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandalarmRate
                                    .rateThreeValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <p class="pfz">二级报警</p>
                        </el-col>
                        <el-col :span="8" v-if="baohanD != 'D'">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">上限预报值≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandtwoValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item>
                            <div class="fac">
                              <span
                                class="wn"
                                v-html="
                                  baohanD == 'D' ? '持续时间≤' : '或 持续时间≤'
                                "
                              ></span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandtwoTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item>
                            <div class="fac">
                              <span class="wn">或 涨幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandalarmRate
                                    .rateTwoValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <p class="pfz">一级报警</p>
                        </el-col>
                        <el-col :span="8" v-if="baohanD != 'D'">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">上限预报值≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandoneValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item>
                            <div class="fac">
                              <span
                                class="wn"
                                v-html="
                                  baohanD == 'D' ? '持续时间≤' : '或 持续时间≤'
                                "
                              ></span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandoneTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item>
                            <div class="fac">
                              <span class="wn">或 涨幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.upGrandalarmBasic.grandalarmRate
                                    .rateOneValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                    </el-row>
                    <el-row
                      :gutter="20"
                      style="margin: 0 10px"
                      v-if="
                        radio1 == '下限分级报警' && form_add2.hasDownGrandAlarm
                      "
                    >
                      <el-row :gutter="20">
                        <el-col :span="24" v-if="form_add2.hasChangeGrandAlarm">
                          <p
                            class="drawer_sub_title"
                            style="margin-left: 0; padding-top: 10px"
                          >
                            <span> 变化参数设置</span>
                          </p>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="变化率判断门限≤">
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .thresholdValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="变化率持续周期">
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .rateCycle
                              "
                              placeholder="请输入"
                            >
                              <template #append>秒</template>
                            </el-input>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <el-row
                        :gutter="20"
                        style="margin-left: 0"
                        v-if="form_add2.hasMoreGrandAlarm"
                      >
                        <el-col :span="24">
                          <p class="pfz">六级报警</p>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">下限预报值≤</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandsixValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 持续时间≤</span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandsixTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 跌幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandalarmRate
                                    .rateSixValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <p class="pfz">五级报警</p>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item
                            label=""
                            v-if="form_add2.hasMoreGrandAlarm"
                          >
                            <div class="fac">
                              <span class="wn">下限预报值≤</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandfiveValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 持续时间≤</span>
                              <el-input
                                disabled
                                oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandfiveTime
                                "
                                placeholder="请输入"
                              >
                                <template #append>分钟</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                        <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                          <el-form-item label="">
                            <div class="fac">
                              <span class="wn">或 跌幅≥</span>
                              <el-input
                                disabled
                                oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                                v-model="
                                  form_add2.downGrandalarmBasic.grandalarmRate
                                    .rateFiveValue
                                "
                                placeholder="请输入"
                              >
                                <template #append>{{ baohanunit }}</template>
                              </el-input>
                            </div>
                          </el-form-item>
                        </el-col>
                      </el-row>
                      <el-col :span="24" style="margin-left: 20px">
                        <p class="pfz">四级报警</p>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">下限预报值≤</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandfourValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 持续时间≤</span>
                            <el-input
                              disabled
                              oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                              v-model="
                                form_add2.downGrandalarmBasic.grandfourTime
                              "
                              placeholder="请输入"
                            >
                              <template #append>分钟</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 跌幅≥</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .rateFourValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <p class="pfz">三级报警</p>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">下限预报值≤</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandthreeValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 持续时间≤</span>
                            <el-input
                              disabled
                              oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                              v-model="
                                form_add2.downGrandalarmBasic.grandthreeTime
                              "
                              placeholder="请输入"
                            >
                              <template #append>分钟</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 跌幅≥</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .rateThreeValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <p class="pfz">二级报警</p>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">下限预报值≤</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandtwoValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 持续时间≤</span>
                            <el-input
                              disabled
                              oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                              v-model="
                                form_add2.downGrandalarmBasic.grandtwoTime
                              "
                              placeholder="请输入"
                            >
                              <template #append>分钟</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 跌幅≥</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .rateTwoValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <p class="pfz">一级报警</p>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">下限预报值≤</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandoneValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 持续时间></span>
                            <el-input
                              disabled
                              oninput="value = value
                                                                                .replace(/[^\d]/g, '')
                                                                                .replace(/^0+/, '')
                                                                                .replace(/(\d{8})\d*/, '$1')
                                                                                .replace(/^$/, '');"
                              v-model="
                                form_add2.downGrandalarmBasic.grandoneTime
                              "
                              placeholder="请输入"
                            >
                              <template #append>分钟</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8" v-if="form_add2.hasChangeGrandAlarm">
                        <el-form-item label="">
                          <div class="fac">
                            <span class="wn">或 跌幅≥</span>
                            <el-input
                              disabled
                              oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{8})\d*/, '$1')"
                              v-model="
                                form_add2.downGrandalarmBasic.grandalarmRate
                                  .rateOneValue
                              "
                              placeholder="请输入"
                            >
                              <template #append>{{ baohanunit }}</template>
                            </el-input>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </div>
                  <!-- 普通断电 -->
                  <div class="desc_box putongClass" v-if="activeNamePoint == 3">
                    <div style="position: relative">
                      <el-button
                        disabled
                        style="
                          position: absolute;
                          top: 10px;
                          right: 20px;
                          z-index: 2;
                          cursor: pointer;
                        "
                        link
                        type="primary"
                        @click="putongAddClick"
                      >
                        <el-icon> <Plus /> </el-icon>新增
                      </el-button>
                      <!-- :closable="form_add2.cutValueList.length==1?false:true" -->
                      <el-tabs
                        v-model="ordintranValue"
                        type="card"
                        class="demo-tabs"
                        v-if="form_add2.cutValueList != null"
                        :closable="true"
                      >
                        <el-tab-pane
                          v-for="(item, index) in form_add2.cutValueList"
                          :key="index + 1"
                          :label="item.title + (index + 1)"
                          :name="index"
                        >
                          <el-row :gutter="20" style="margin-top: 10px">
                            <el-col :span="6">
                              <el-form-item label="断电模式">
                                <el-select
                                  clearable
                                  filterable
                                  v-model="item.cutType"
                                  placeholder="请选择"
                                  disabled
                                >
                                  <el-option
                                    v-for="item in cutTypeList"
                                    :key="item.code"
                                    :label="item.name + '断电'"
                                    :value="item.code"
                                  >
                                  </el-option>
                                </el-select>
                              </el-form-item>
                            </el-col>
                            <el-col
                              :span="6"
                              v-if="item.cutType == 1 && baohanD != 'D'"
                            >
                              <el-form-item label="断电值≥">
                                <el-input
                                  disabled
                                  v-model="item.cutValue"
                                  oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                  placeholder="请输入"
                                >
                                </el-input>
                              </el-form-item>
                            </el-col>
                            <el-col
                              :span="6"
                              v-if="item.cutType == 1 && baohanD != 'D'"
                            >
                              <el-form-item label="复电值＜">
                                <el-input
                                  disabled
                                  v-model="item.resumeValue"
                                  oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                  placeholder="请输入"
                                >
                                </el-input>
                              </el-form-item>
                            </el-col>
                            <el-col
                              :span="6"
                              v-if="item.cutType == 2 && baohanD != 'D'"
                            >
                              <el-form-item label="断电值≤">
                                <el-input
                                  disabled
                                  v-model="item.cutValue"
                                  oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                  placeholder="请输入"
                                >
                                </el-input>
                              </el-form-item>
                            </el-col>
                            <el-col
                              :span="6"
                              v-if="item.cutType == 2 && baohanD != 'D'"
                            >
                              <el-form-item label="复电值＞">
                                <el-input
                                  disabled
                                  v-model="item.resumeValue"
                                  oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                                  placeholder="请输入"
                                >
                                </el-input>
                              </el-form-item>
                            </el-col>
                            <el-col :span="6">
                              <el-button
                                disabled
                                link
                                type="primary"
                                style="margin-top: 35px"
                                @click="addcutdeviceClick"
                              >
                                <el-icon> <Plus /> </el-icon>断电设备
                              </el-button>
                            </el-col>
                            <el-col :span="24" style="padding: 10px">
                              <el-collapse v-model="collapseAtive" accordion>
                                <el-collapse-item
                                  :name="index2"
                                  v-for="(item2, index2) in item.cutStationList"
                                  :key="item2"
                                  @click="clickCollapse(item2, index2)"
                                >
                                  <template #title>
                                    <div class="fbc w100" @click="stopCollapse">
                                      <span style="padding-top: 22px">
                                        <el-form-item label="">
                                          <span>分站</span>
                                          <el-select
                                            clearable
                                            filterable
                                            v-model="item2.stationCode"
                                            placeholder="请选择"
                                            disabled
                                            @change="
                                              controlPortChange($event, index2)
                                            "
                                          >
                                            <el-option
                                              v-for="item in stationPlaceNamList"
                                              :key="item.stationCode"
                                              :label="
                                                item.stationCode +
                                                '/' +
                                                item.stationPlaceName
                                              "
                                              :value="item.stationCode"
                                            >
                                            </el-option>
                                          </el-select>
                                        </el-form-item>
                                      </span>
                                    </div>
                                  </template>
                                  <div style="margin-top: 10px">
                                    <vxe-table
                                      border
                                      ref="tableRef2"
                                      :data="item2.controlPortList"
                                      :row-config="{
                                        useKey: true,
                                        keyField: 'pointId',
                                      }"
                                    >
                                      <vxe-column type="checkbox" width="60">
                                      </vxe-column>
                                      <vxe-column
                                        field="controlPort"
                                        title="开出口号"
                                      >
                                      </vxe-column>
                                      <vxe-column
                                        field="controlPortTypeName"
                                        title="控制设备"
                                      >
                                      </vxe-column>
                                      <vxe-column
                                        field="pointPlaceName"
                                        title="安装地点"
                                      >
                                      </vxe-column>
                                      <vxe-column
                                        field="feedPointId"
                                        title="馈电测点"
                                      >
                                      </vxe-column>
                                      <vxe-column
                                        field="feedSensorName"
                                        title="馈电设备"
                                      >
                                      </vxe-column>
                                    </vxe-table>
                                  </div>
                                </el-collapse-item>
                              </el-collapse>
                            </el-col>
                          </el-row>
                        </el-tab-pane>
                      </el-tabs>
                    </div>
                  </div>
                  <!-- </teleport> -->
                  <div class="desc_box" v-if="activeNamePoint == 4">
                    <el-row :gutter="20">
                      <el-col :span="8">
                        <el-form-item label="断电区域">
                          <el-cascader
                            disabled
                            style="width: 416px"
                            v-model="form_add2.cutArea.areaIdList"
                            :options="searchTreeList"
                            clearable
                            :props="{
                              children: 'childList',
                              value: 'id',
                              label: 'areaName',
                              emitPath: false,
                              multiple: true,
                            }"
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item
                          :label="baohanD != 'D' ? '断电值' : '断电值≥'"
                        >
                          <el-input
                            disabled
                            oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                            v-model="form_add2.cutArea.cutValue"
                            placeholder="请输入"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                      <el-col :span="8">
                        <el-form-item
                          :label="baohanD != 'D' ? '复电值' : '复电值＜'"
                        >
                          <el-input
                            disabled
                            oninput="value =value.replace(/[^\-\d.]/g, '') .replace(/^\./g, '').replace(/\.{2,}/g,
'.').replace(/(\.\d+)\./g, '$1') .replace(/(-)\./g, '$1') .replace(/\-{2,}/g, '-')
.replace(/(\d+|\.)-/g, '$1') .replace(/-(0){2,}/g,'$1') .replace(/(-)0+(\d+)/g, '$1$2')
.replace(/^0+(\d)/, '$1') .replace(/(\d{8})\d*/, '$1') .replace(/(\.\d{2})\d*/, '$1')"
                            v-model="form_add2.cutArea.resumeValue"
                            placeholder="请输入"
                          >
                          </el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </div>
                </el-col>
              </el-row>
            </div>
          </el-form>
        </div>
      </template>
      <template #footer>
        <div class="footer_btns">
          <div>
            <el-button @click="open_add2 = false">取消</el-button>
            <el-button type="primary" @click="open_add2 = false"
              >确定</el-button
            >
            <!-- <oneclickDelivery></oneclickDelivery> -->
          </div>
        </div>
      </template>
    </el-drawer>
  </div>
</template>
<script setup>
import list_controller from "@/components/commonCom/list_controller";
import { computed, reactive } from "vue";
import { table_headers } from "@/components/commonCom/table_headers";
import axios from "@/utils/request";
import usePagesStore from "@/store/modules/pages";
import dayjs from "dayjs";
const { proxy } = getCurrentInstance();
const store = usePagesStore();
let state = reactive({
  tabNameData: "历史测点",
  options: {
    tableheads: computed(() => table_headers.pointEx),
    queryList: {
      dropdownUrl: "",
      querys: [
        {
          field: "key",
          title: "模糊搜索",
          type: "input",
          binddata: "",
          tip:'请输入测点编号或者名称、地点'
        },
        {
          field: "time",
          title: "时间范围",
          col: 8,
          type: "hisdatetimerange",
          binddata: [
            dayjs().subtract(1, "month").format("YYYY-MM-DD HH:mm:ss"),
            dayjs().format("YYYY-MM-DD HH:mm:ss"),
          ],
          typespecial: 2,
          show: false,
        },
      ],
      queryMap: new Map([]),
    },
    dataUrl: "/point/ex",
  },
});

const pointactiveNameList = ref([
  {
    name: "报警配置",
    type: 1,
  },
  {
    name: "分级配置",
    type: 2,
  },
  {
    name: "普通断电",
    type: 3,
  },
  {
    name: "区域断电",
    type: 4,
  },
]);
const radio1 = ref(""); //上下级分级切换
const activeNamePoint = ref("1");
const editpointId = ref(null);
const expressionVoList = ref([]); //
const needPlaceType = ref(undefined);
const curTreeId = ref(undefined);
const open_add2 = ref(false);
const collapseAtive = ref(0);
const activeName = ref("2");
const baohanD = ref(""); //筛选首字母
const cutValueListyou = ref(false); //测点详情查看处理普通断电
const subStationInfo = ref({});
const stationPlaceNamList = ref([]);
const ordintranValue = ref(0);
const form_add2 = ref({
  gasDrainageGroupno: 1,
  hasUpGrandAlarm: false,
  hasDownGrandAlarm: false,
  hasMoreGrandAlarm: false,
  hasChangeGrandAlarm: false,
  calibration: {
    isCalibration: false,
  },
  alarmBasic: {},
  prealarmBasic: {},
  upGrandalarmBasic: {
    grandalarmRate: {},
  },
  downGrandalarmBasic: {
    grandalarmRate: {},
  },
  cutArea: {},
  cutValueList: [
    // {
    //   title: "断电配置",
    //   name: "1",
    //   cutStationList: [
    //     {
    //       controlPortList: [],
    //     },
    //   ],
    // },
  ],
});
const alarmBasicList = ref([
  {
    code: 0,
    name: "无",
  },
  {
    code: 1,
    name: "上限",
  },
  {
    code: 2,
    name: "下限",
  },
  {
    code: 3,
    name: "上下限",
  },
]);
const cutTypeList = ref([
  {
    //断电模式
    code: 1,
    name: "上限",
  },
  {
    code: 2,
    name: "下限",
  },
]);

// 过滤器
const formatCloud = (str) => {
  return str.charAt(0);
};
// 打开测点详情弹窗
const openPointEdit = (item, n) => {
  if(!item.pointId.includes("V") || !item.pointId.includes("M")){
    open_add2.value = true;
    editpointId.value = item.id;
    getponitdetailData(item.id, n);
  }
};
//获取普通测点详情数据
const getponitdetailData = (id, num) => {
  cutValueListyou.value = true
  if (num) {
    activeNamePoint.value = num;
  } else {
    activeNamePoint.value = 1;
  }
  let alarmtypeList = [
    {
      code: 0,
      name: "无",
    },
  ];
  let alarmtypeList2 = [];
  axios.get(`/point/exDetail?id=` + id).then((res) => {
    form_add2.value = res.data;
    needPlaceType.value = form_add2.value.needPlaceType;
    curTreeId.value = form_add2.value.pointId;
    // baohanD.value = formatCloud(form_add2.value.sensorId);
    if (form_add2.value.cutArea && form_add2.value.cutArea != null) {
      if (form_add2.value.cutArea.areaIdList) {
        if (form_add2.value.cutArea.areaIdList.length > 0) {
          form_add2.value.cutArea.areaIdList =
            form_add2.value.cutArea.areaIdList.map((item) => {
              return Number(item);
            });
        }
      }
    } else {
      form_add2.value.cutArea = null;
    }
    if (baohanD.value == "D") {
      if (form_add2.value.highShow != null) {
        alarmtypeList.push({
          code: 1,
          name: form_add2.value.highShow,
        });
        alarmtypeList2.push({
          code: 1,
          name: form_add2.value.highShow,
        });
      }
      if (form_add2.value.lowShow != null) {
        alarmtypeList.push({
          code: 2,
          name: form_add2.value.lowShow,
        });
        alarmtypeList2.push({
          code: 2,
          name: form_add2.value.lowShow,
        });
      }
      alarmBasicList.value = alarmtypeList;
      cutTypeList.value = alarmtypeList2;
    } else {
      alarmBasicList.value = [
        {
          code: 0,
          name: "无",
        },
        {
          code: 1,
          name: "上限",
        },
        {
          code: 2,
          name: "下限",
        },
        {
          code: 3,
          name: "上下限",
        },
      ];
      cutTypeList.value = [
        {
          code: 1,
          name: "上限",
        },
        {
          code: 2,
          name: "下限",
        },
      ];
    }
    if (form_add2.value.upGrandalarmBasic == null) {
      form_add2.value.upGrandalarmBasic = {
        grandalarmRate: {
          thresholdValue: "",
          rateCycle: "",
        },
      };
    } else {
      if (form_add2.value.upGrandalarmBasic.grandalarmRate == null) {
        form_add2.value.upGrandalarmBasic.grandalarmRate = {
          thresholdValue: "",
        };
        form_add2.value.upGrandalarmBasic.grandalarmRate = {
          rateCycle: "",
        };
      }
    }
    if (form_add2.value.downGrandalarmBasic != null) {
      if (form_add2.value.downGrandalarmBasic.grandalarmRate == null) {
        form_add2.value.downGrandalarmBasic.grandalarmRate = {
          thresholdValue: "",
        };
        form_add2.value.downGrandalarmBasic.grandalarmRate = {
          rateCycle: "",
        };
      }
    } else {
      form_add2.value.downGrandalarmBasic = {
        grandalarmRate: {
          thresholdValue: "",
          rateCycle: "",
        },
      };
    }
    if (form_add2.value.hasUpGrandAlarm) {
      radio1.value = "上限分级报警";
    }
    if (form_add2.value.cutValueList != null) {
      if (form_add2.value.cutValueList.length > 0) {
        if (cutValueListyou.value == true) {
          let arr = [];
          form_add2.value.cutValueList.forEach((item, index) => {
            item.cutStationList.forEach((item2) => {
              item2.controlPortList.forEach((item3) => {
                if (item3.selected == true) {
                  item3.stationCode = item2.stationCode;
                  item3.stationPlaceName = item2.stationPlaceName;
                  arr.push(item3);
                }
              });
              item2.controlPortList = arr;
            });
          });
          form_add2.value.cutValueList.forEach((item, index) => {
            item.title = "断电配置";
            item.name = index + 1;
          });
        } else {
          form_add2.value.cutValueList.forEach((item, index) => {
            item.title = "断电配置";
            item.name = index + 1;
          });
        }
      }
    }
  });
};
// 弹窗关闭时执行
const closeMoadl = () => {
  form_add2.value = {
    gasDrainageGroupno: 1,
    hasUpGrandAlarm: false,
    hasDownGrandAlarm: false,
    hasMoreGrandAlarm: false,
    hasChangeGrandAlarm: false,
    calibration: {
      isCalibration: false,
    },
    alarmBasic: {},
    prealarmBasic: {},
    upGrandalarmBasic: {
      grandalarmRate: {},
    },
    downGrandalarmBasic: {
      grandalarmRate: {},
    },
    cutArea: {},
    cutValueList: [
      {
        title: "断电配置",
        name: "1",
        cutStationList: [
          {
            controlPort: "",
            pointPlaceName: "",
          },
        ],
      },
    ],
  };
  collapseAtive.value = 0;
};
// 测点tab切换--关联电源/其他配置/操作日志
let tableRef2 = ref();
const ponitactiveNameTabClick = (type) => {
  activeNamePoint.value = type;
  if (type == 3) {
    getcontrolPortsList();
    let arr = [];
    form_add2.value.cutValueList.forEach((item) => {
      item.cutStationList.forEach((item2) => {
        item2.controlPortList.forEach((item3) => {
          if (item3.selected) {
            arr.push(item3);
          }
        });
      });
    });
    nextTick(() => {
      tableRef2.value[0].setCheckboxRow(arr, true);
    });
  }
  if (type == 4) {
    if (form_add2.value.cutArea == null) {
      form_add2.value.cutArea = {};
    }
  }
};
const getcontrolPortsList = (val) => {
  axios.post("/station/list", {}).then((res) => {
    stationPlaceNamList.value = res.data.list;
  });
};
</script>
<style scoped lang="scss">

.activeNameTab {
  color: #333;
  font-size: 14px;
  font-weight: 700;
  padding: 0 10px;

  .span1,
  .span {
    position: relative;
    margin-right: 20px;
    cursor: pointer;

    &.span1 {
      margin-right: 0;
      padding: 8px 20px;
      border-radius: 4px 4px 0 0;
    }

    &.active {
      position: relative;

      &::before {
        position: absolute;
        content: "";
        left: 50%;
        bottom: -10px;
        width: 56px;
        height: 2px;
        background-color: rgba(64, 158, 255, 1);
        transform: translate(-50%, -50%);
      }
    }

    &.active1 {
      border-radius: 4px 4px, 0px, 0px;
      background: linear-gradient(
        180deg,
        rgba(91, 109, 128, 0.12) 0%,
        rgba(91, 109, 128, 0.04) 100%
      );
    }
  }
}
// 分站编辑
::v-deep .edit {
  width: 912px !important;
  // height: 100%;
  .edit_box {
    width: 100%;
    height: 100%;
    .basic_info {
      padding: 16px;
      height: 380px;
    }
    .basic_info2 {
      padding: 16px;
    }
    .others {
      height: calc(100% - 380px);
    }
  }
  .footer_btns {
    display: flex;
    justify-content: space-between;
  }
}
// 分站详情
::v-deep .detail {
  width: 912px !important;
  // height: 100%;
  .detail_box {
    width: 100%;
    height: 100%;
    .basic_info {
      padding: 16px;
      height: 285px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .location {
        display: flex;
        align-items: center;
        font-size: 14px;
        font-weight: 700;
        color: rgba(62, 70, 79, 1);
      }
      .line {
        height: 1px;
        background-color: rgba(91, 109, 128, 0.3);
      }
      .info_data {
        height: 204px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .img_box {
          width: 200px;
          height: 142px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          align-items: center;
          font-size: 14px;
          .name {
            font-weight: 700;
          }
          img {
            width: 51px;
            height: 66px;
          }
        }
        .data_box {
          width: 632px;
          height: 100%;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .data_row {
            display: flex;
          }
          .data_item {
            height: 36px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            color: rgba(62, 70, 79, 1);
            font-size: 14px;
            .item_title {
              color: rgba(62, 70, 79, 0.6);
            }
          }
        }
      }
      .others {
        height: 275px;
      }
    }
  }
  .footer_btns {
    display: flex;
    justify-content: space-between;
  }
}
.demo-tabs {
  .custom-tabs-label {
    display: flex;
    align-items: center;
  }
  .tabs_box {
    height: 220px;
  }
  .one {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .data_row {
      display: flex;
      justify-content: space-between;
    }
    .data_item {
      width: 154px;
      height: 36px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      color: rgba(62, 70, 79, 1);
      font-size: 14px;
      .item_title {
        color: rgba(62, 70, 79, 0.6);
      }
    }
  }
  .two {
    display: flex;
    justify-content: space-between;
    .items {
      font-size: 14px;
      color: rgba(62, 70, 79, 0.8);
    }
  }
  .three {
    height: 300px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    .three_header {
      display: flex;
      justify-content: space-between;
      color: rgba(62, 70, 79, 0.8);
      font-size: 14px;
      .header_item {
        display: flex;
        align-items: center;
      }
      .btns {
        width: 140px;
        display: flex;
        justify-content: space-between;
      }
    }
    .table {
      margin-top: 12px;
    }
  }
}
</style>
